package com.winchain.provider;

import com.shell.bee.acct.account.po.AcctBas;
import com.shell.bee.base.utils.Encryptor;
import com.winchain.chainbill.trade.service.BillAcctService;

import java.io.UnsupportedEncodingException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TrdAcctProvider {
	protected final Log logger = LogFactory.getLog(getClass());
	@Autowired
	private BillAcctService billAcctService;

	@RequestMapping({ "/acct/getChainAddr" })
	public String getChainAddr(@RequestParam("cusId") String cusId, @RequestParam("useCode") String useCode) {
		AcctBas bas = this.billAcctService.getAcctBas(cusId, useCode, null);
		return bas.getAcctNo().substring(3);
	}
	
	public static void main(String[] args) throws UnsupportedEncodingException {
		String pwd = "A3FDD27D47DD9E82";
		System.out.println(Encryptor.decrypt(pwd));
		 
	}
}
